<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class Main_Form_Register extends WOW_Form_Abstract
{
    public $elementDecorators = array(
            'ViewHelper',

            array(array('data' => 'HtmlTag'), array('tag' => 'span' )),
            array('Label', array('tag' => 'span')

            )
    );

    public function init()
    {
        $this->addElement('text', 'FirstName', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', true, array(2, 128)),
                array('UniqueUsername', false, array(new Main_Model_User()))
            ),
            'required'  => true,
            'label'     => 'FirstName',
            'class'     => 'frmInput',
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('text', 'LastName', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', true, array(2, 128))
            ),
            'required'  => true,
            'label'     => 'LastName',
            'class'     => 'frmInput',
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('text', 'Gender', array(
            'filters'    => array('StringTrim', 'StringToLower'),
            'required'  => true,
            'label'     => 'Gender',
            'class'     => 'frmInput',
            'multiOptions' => array('1' => 'Male', '2' => 'Female'),
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('text', 'UserEmail', array(
            'filters'    => array('StringTrim', 'StringToLower'),
            'validators' => array(
                array('StringLength', true, array(5, 128))
            ),
            'required'  => true,
            'label'     => 'Email',
            'class'     => 'frmInput',
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('password', 'Password', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', true, array(6, 128))
            ),
            'required'   => true,
            'label'      => 'Password',
            'class'     => 'frmInput',
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('password', 'passwdVerify', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                 'PasswordVerification',
            ),
            'required'   => true,
            'label'      => 'Confirm Password',
            'class'     => 'frmInput',
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('submit', 'Register', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'Register',
        ));
        
        $this->setDecorators(array(
            'FormElements',
            array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
            array('Description', array('placement' => 'prepend', 'class' => 'error')),
            'Form'
        ));
    }


}

?>
